package pojo;

import java.io.Serializable;
import java.util.Objects;

/**
 * @author ： CodeWater
 * @create ：2022-04-05-16:05
 * @Function Description ：
 *
 * 1.实体类的类名应该与表格名称对应
 * 2.实体类的属性名应该与列名对应
 * 3.实体类的属性类型应私有
 * 4.实体类属性的getter和setter方法
 * 5.实体类必须具备无参构造器
 * 6.应该实现序列化接口（缓存 分布式项目数据传递 可能会将数据序列化）
 * 7.应该重写hashcode与equals方法
 * 8.toString方法是否重写都可以
 *
 * 使用lombook帮助我们生成getter和setter方法
 *  1.检查idea是否以及安装了lombook插件
 *  2.是否勾选了enable annotation processing
 *  3.导入lombook依赖(下载依赖包放入WEB-INF/lib 下)
 *  4.使用@Data注解
 */
public class SysUser implements Serializable {
    private Integer uid;
    private  String username;
    private String userPwd;

    public SysUser() {
    }

    public SysUser(Integer uid, String username, String userPwd) {
        this.uid = uid;
        this.username = username;
        this.userPwd = userPwd;
    }

    public Integer getUid() {
        return uid;
    }

    public void setUid(Integer uid) {
        this.uid = uid;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getUserPwd() {
        return userPwd;
    }

    public void setUserPwd(String userPwd) {
        this.userPwd = userPwd;
    }

    @Override
    public boolean equals(Object o) {
        if (o == null || getClass() != o.getClass()) return false;
        SysUser sysUser = (SysUser) o;
        return Objects.equals(uid, sysUser.uid) && Objects.equals(username, sysUser.username) && Objects.equals(userPwd, sysUser.userPwd);
    }

    @Override
    public int hashCode() {
        return Objects.hash(uid, username, userPwd);
    }

    @Override
    public String toString() {
        return "SysUser{" +
                "uid=" + uid +
                ", username='" + username + '\'' +
                ", userPwd='" + userPwd + '\'' +
                '}';
    }
}
